package com.yunhe.history.client;

import com.yunhe.history.client.fallback.DeviceFallbackFactory;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.device.Analog;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;

/**
 * @author liuronglei
 */
@ApiIgnore
@FeignClient(value = "yh-device", fallbackFactory = DeviceFallbackFactory.class)
@Component
public interface DeviceClient {

    /**
     * 根据设备代码和类型ID获得点表对象
     * @param deviceId 设备ID
     * @param typeId 点号数据类型ID
     * @param typeName 点号数据类型name
     */
    @RequestMapping(value = "/analogs/byDevAndTypeAndTerminal", method = RequestMethod.GET)
    ResponseEntity<ResultObject<Analog>> getAnalogByDevAndType(@RequestParam("deviceId") Long deviceId,
                                                               @RequestParam("typeId") Long typeId,
                                                               @RequestParam("typeName") String typeName);

    @RequestMapping(value = "/analogs/byDevAndType", method = RequestMethod.GET)
    ResponseEntity<ResultObject<List<Analog>>> getAnalogsByDevAndType(@RequestParam("deviceId") Long deviceId,
                                                                      @RequestParam("typeId") Long typeId,
                                                                      @RequestParam("typeName") String typeName);
}
